<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<div>
    <table id="wQbdTecBasicmanageTable" lay-filter="wQbdTecBasicmanageTable"></table>
    <form class="reportList-isShow">
        <input type="hidden" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdTecBasicmanageTableRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>

<script>
    //一般直接写在一个js文件中
    layui.use(['table', 'publicMethods','jquery','layer'], function () {
        var table = layui.table;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;

        var tableH=publicMethods.layerHeight();
        var dataId = "${dataId}";

        var cols = '${cols}';
        var currentSystemLevel = "${currentSystemLevel}";
        var commonCols = [
            //表头
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
            ,{field: 'filldept', title: '数据来源单位',minWidth:120}
            ,{field: 'fItemname', title: '项目名称',minWidth:110}
            ,{field: 'fMainunit', title: '主承担单位',minWidth:120}
            ,{field: 'fItemnumber', title: '项目编号',minWidth:110}
            ,{field: 'fTopictype', title: '课题类型',minWidth:110}
            ,{field: 'fItemtype', title: '项目类别',minWidth:110}
            ,{field: 'fClassification', title: '技术领域',minWidth:110}
            ,{field: 'fApprovalmoney', title: '批复总经费',minWidth:120}
        ];
        var hideCols = [
            ,{field: 'fItemdeptaddress', title: '项目单位地址',hide: true}
            ,{field: 'fTestmodel', title: '拟试点型号',hide: true}
            ,{field: 'fItemstartdate', title: '项目起始时间',hide: true}
            ,{field: 'fResearchcycle', title: '研究周期',hide: true}
            ,{field: 'fDeptchargeperson', title: '单位负责人', hide: true}
            //
            // ,{field: 'fMainunitid', title: '主承担单位ID',sort:false, sortname: 'f_mainunitid'}
            ,{field: 'fTopicchargeperson', title: '课题负责人', hide: true}
            ,{field: 'fTelephonenumber', title: '联系电话',hide: true}
            ,{field: 'fUniondept', title: '联合承担单位', hide: true}
            ,{field: 'fItemapprovalnumber', title: '立项批复文号', hide: true}
            ,{field: 'fTaskapprovalnumber', title: '任务书批复文号',hide: true}

            ,{field: 'fNationalmoney', title: '国拨资金', hide: true}
            ,{field: 'fRaisemoney', title: '自筹资金',hide: true}
            ,{field: 'fIfcompleteaudit', title: '是否完成审计', hide: true}
            ,{field: 'fPlanauditdate', title: '计划审计时间', hide: true,templet: function (d) {
                return publicMethods.timeData(d.fPlanauditdate);
            }}
            ,{field: 'fActualauditdate', title: '审计实际完成时间', hide: true,templet: function (d) {
                return publicMethods.timeData(d.fActualauditdate);
            }}
            ,{field: 'fPlancheckdate', title: '计划验收时间', hide: true,templet: function (d) {
                return publicMethods.timeData(d.fPlancheckdate);
            }}
            ,{field: 'fActualcheckdate', title: '验收完成时间',hide: true,templet: function (d) {
                return publicMethods.timeData(d.fActualcheckdate);
            }}
            ,{field: 'fMemo', title: '备注', hide: true}
            ,{field: 'fKeytechnology', title: '突破关键技术', hide: true}
            ,{field: 'fPrototype', title: '原理样机', hide: true}
            ,{field: 'fSample', title: '材料样品',hide: true}
            ,{field: 'fSamplenum', title: '样件',hide: true}
            ,{field: 'fEquipment', title: '装备', hide: true}
            ,{field: 'fDemosystem', title: '集成验证或演示系统', hide: true}
            ,{field: 'fDatabase', title: '数据库',  hide: true}
            ,{field: 'fTechnicalstandard', title: '技术标准', hide: true}
            ,{field: 'fProcessspecification', title: '工艺规范', hide: true}
            ,{field: 'fApplicationpatent', title: '申请发明专利', hide: true}
            ,{field: 'fAuthorizedpatent', title: '授权发明专利', hide: true}
            ,{field: 'fTrademark', title: '商标',hide: true}
            ,{field: 'fSoftware', title: '软件',hide: true}
            ,{field: 'fCopyright', title: '软件著作权', hide: true}
            ,{field: 'fPaper', title: '论文', hide: true}
            ,{field: 'fMonograph', title: '专著',hide: true}
            ,{field: 'fGraduatestudent', title: '培养研究生', hide: true}
            ,{field: 'fModelproducts', title: '应用型号产品', hide: true}
            ,{field: 'fReports', title: '国防科技工业科技报告',hide: true}
            ,{field: 'fCheckdept', title: '组织验收部门',hide: true}
            ,{field: 'fRatinglevel', title: '评定等级',hide: true}
            ,{field: 'fPresidingexpert', title: '主审专家', hide: true}
            ,{field: 'fAssessmentleader', title: '评审组组长', hide: true}
            ,{field: 'fCheckapprovalnumber', title: '验收批复文号', hide: true}
            ,{field: 'fIfconclusion', title: '是否结题', hide: true}
            ,{field: 'fNecessity', title: '必要性', hide: true}
            ,{field: 'fKeypoints', title: '对应的要点', hide: true}
            ,{field: 'fTarget', title: '主要研究目标',hide: true}
            ,{field: 'fContent', title: '主要研究内容', hide: true}
            ,{field: 'fAchievements', title: '预期成果物',hide: true}
            ,{field: 'fMajorproblems', title: '针对解决的重大问题', hide: true}
            ,{field: 'fRecommendation', title: '建议书', hide: true}
            ,{field: 'fRecommendationpages', title: '建议书页数', hide: true}
            ,{field: 'fTaskbook', title: '任务书', hide: true}
            ,{field: 'fAcceptancereport', title: '验收报告', hide: true}
            ,{field: 'belongdeptname', title: '所属单位', hide: true}
            ,{field: 'fIfadjustment', title: '是否调整',hide: true}
        ];
        var diyCols = [];
        // if ("GROUPLEVEL" !== currentSystemLevel) {
        //     diyCols = [{field: 'fReportStatus', title: '上报状态',sort:false, sortname: 'f_report_status'}];
        // }
        /*if ("GROUPLEVEL" !== currentSystemLevel) {
            diyCols = [{field: 'reportStatusStr', title: '状态',sort:false, sortname: 'REPORT_STATUS'}];
        }*/
        var manageCols =[{
            fixed: 'right',
            title: '管理',
            width:80,
            align:'center',
            toolbar: '#wQbdTecBasicmanageTableRightToolsBar'
        }];
        var totalCols = [];
        totalCols = totalCols.concat(commonCols).concat(hideCols).concat(diyCols).concat(manageCols);
        //第一个实例
        table.render({
            elem: '#wQbdTecBasicmanageTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/wQbdTecBasicmanage/reportList?id='+dataId+'&tableName=w_qbd_tec_basicmanage'
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [cols ? JSON.parse(cols) : totalCols],done:function () {
            }
        });


        table.on('tool(wQbdTecBasicmanageTable)', function(obj) {
            var data = obj.data; //获得当前行数据
            if(obj.event == "particulars"){
                var height=publicMethods.layHeight('body');
                layer.open({
                    type: 2,
                    area: ['96%', height],
                    title: ['课题信息详情'],
                    content: serverPath.qbdmsPath + '/qbdms/wQbdTecBasicmanage/view/particulars?id='+data.id + "&isClose=true"
                });
            }
        });

        table.on('checkbox(wQbdTecBasicmanageTable)', function(obj){
            if(obj.type == "all"){
                if(obj.checked){
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdTecBasicmanageTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for(var i=0;i<valArr.length;i++){
                        ceshiVal =ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                }else{
                    $("input[name='successDataId']").val("");
                }
            }else{
                if(obj.checked){
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                }else{
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id+",");
                    for(var i=0;i<valArr.length;i++){
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });

    });
</script>
<!--</body>-->
<!--</html>-->